Skip to content

fix: try to fit message as far as possible#3466

Merged
isekovanic merged 1 commit intodevelopfrom
fix/fit-message-anchor-properly
Mar 7, 2026
Merged

fix: try to fit message as far as possible#3466
isekovanic merged 1 commit intodevelopfrom
fix/fit-message-anchor-properly

Conversation

@isekovanic
Copy link
Contributor

🎯 Goal

This PR fixes an edge case where the teleported message would not properly try to fit as much as it can within the screen if the total sum of the top item height, its own height and the bottom item height would be greater than the screen height.

With this, we'll always try to animate the message as far as we can and clamp the animation to its boundaries. The bottom item will still overlap any excess height as it was before.

🛠 Implementation details

🎨 UI Changes

iOS
Before After
Android
Before After

🧪 Testing

☑️ Checklist

  • I have signed the Stream CLA (required)
  • PR targets the develop branch
  • Documentation is updated
  • New code is tested in main example apps, including all possible scenarios
    • SampleApp iOS and Android
    • Expo iOS and Android

const maxTopWithoutBottom = maxY - msgH;
const maxTop = minTop <= maxTopWithBottom ? maxTopWithBottom : maxTopWithoutBottom;
const solvedTop = clamp(anchorY, minTop, Math.max(minTop, maxTop));
const canFitBottomWithoutOverlap = minTop <= maxTopWithBottom;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for myself: At some point this should come as an overridable function, allowing more control over how these calculations work.

@Stream-SDK-Bot
Copy link
Contributor

SDK Size

title develop branch diff status
js_bundle_size 369 KB 369 KB 0 B 🟢

@isekovanic isekovanic merged commit ba4bff0 into develop Mar 7, 2026
5 checks passed
@isekovanic isekovanic deleted the fix/fit-message-anchor-properly branch March 7, 2026 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants